//
//  DayAxisValueFormatter.swift
//  MYModule
//
//  Created by 李然 on 2022/9/14.
//

import UIKit
import Charts

public class DayAxisValueFormatter: NSObject, IAxisValueFormatter {
    
    public func stringForValue(_ value: Double, axis: AxisBase?) -> String {

        let index = Int(value)
        
        if index == 46 {
            return timeString(with: 48)
        }

        if index % 12 == 0 {
            return timeString(with: index)
        }

        return ""
    }
    
    private func timeString(with index:Int) -> String{
        let idx = index / 2
        return idx.leadingZero + ":00"
    }
    
}
